#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>

int main()
{
	//FILE* fp = fopen("myfile.txt","w");
	const char* msg = "hello world";
	char read[1024] = { 0 };
	int count = 5;
	//if (fp==NULL)
	//{
	//	printf("fopen  error!\n");
	//}
	//else
	//{
	//	while (count--)
	//	{
	//		fwrite(msg, strlen(msg), 1, fp);
	//	}
	//	
	//}
	//fclose(fp);
	FILE* fp = fopen("myfile.txt", "r");
	if (fp == NULL)
	{
		printf("fopen  error!\n");
	}
	else
	{
		while (1)
		{
			size_t s = fread(read, strlen(msg), 1, fp);
			if (feof(fp))
			{
				fclose(fp);
				break;
			}
			printf("%s", read);
		}
	}
	return 0;
}

